﻿using InDepth2Demo.Chapter1.C11;
using System.Collections;

namespace InDepth2Demo.Chapter1.C21
{
    internal class ProductNameComparer : IComparer
    {
        public int Compare(object x, object y)
        {
            Product first = (Product)x;
            Product second = (Product)y;
            return first.Name.CompareTo(second.Name);
        }

        //IComparer:
        //int Compare(object x, object y);


        //IComparable:
        //Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
        // int CompareTo(object obj);
    }
}
